package com.grf.hadoop.practice;

import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.mapreduce.Partitioner;

public class HttpPartitioner extends Partitioner<HttpBean, NullWritable> {

    @Override
    public int getPartition(HttpBean key, NullWritable nullWritable, int i) {
        int partition = 4;
        if (key.getTel().substring(0, 3).equals("136")) {
            partition = 0;
        } else if (key.getTel().substring(0, 3).equals("137")) {
            partition = 1;
        } else if (key.getTel().substring(0, 3).equals("138")) {
            partition = 2;
        } else if (key.getTel().substring(0, 3).equals("139")) {
            partition = 3;
        }
        return partition;
    }

}
